package sctu.edu.java.year2016.team05.xiongyihui.day20160522.chapter4_3;

/**
 * Created by 熊怡惠 on 2016/5/22.
 * 编写JAVA程序，使用while循环语句计算出1+1/2！+1/3！+...1/20!之和。
 */

public class three {
    public static void main(String[] args) {
        int i = 1;
        double sum = 0, a = 1;
        while (i <= 20) {
            sum += a;
            i++;
            a *= (1.0 / i);
        }
        System.out.println(sum);

    }
}


